// import Util from "./util.js"
	import {
		ElMessageBox
	} from 'element-plus'

import IDCardstr from "./public.js"
function checkbuttonclick(Column, row1, row2,nowdate) {
    let IDCardarr = Application.ActiveSheet.Range(`${Column}${row1}:${Column}${row2}`).Value2
    let newArr = IDCardarr.flat()
    let objarr = []
    let obj = {}
    for (let i = 0; i < newArr.length; i++) {
        let reText = IDCardstr.getInfo(newArr[i], nowdate)
        obj = {
            status: reText.status,
            sex: reText.sex,
            birth: reText.birth,
            birth1: reText.birth1,
            birth2: reText.birth2,
            code: reText.code,
            address: reText.address,
            age: reText.age
        }
        objarr.push(obj)
    }
    let id = 1;
    const newIDCardarr = IDCardarr.map(subarray => ({
        IDCard: subarray[0],
        status: objarr[id - 1].status,
        garder: objarr[id - 1].sex,
        date1: objarr[id - 1].birth,
        date2: objarr[id - 1].birth1,
        date3: objarr[id - 1].birth2,
        code: objarr[id - 1].code,
        address: objarr[id - 1].address,
        age: objarr[id - 1].age,
        id: id++
    }));
    return newIDCardarr
}

function writebuttonclick(Column, row1, row2,date) {
    let y=0;
    for (let i = row1; i-1 < row2; i++) {
        Application.ActiveSheet.Range(`${Column}${i}`).Value2=date[y];
        y++;
    }
}


export default {
    checkbuttonclick,
    writebuttonclick
}